package com.cmower.dzone.optional;

import java.util.Optional;

public class CheckOptionalDemo {
    public static void main(String[] args) {
Optional<String> opt = Optional.of("沉默王二");
System.out.println(opt.isPresent());
        System.out.println(opt.isEmpty());

opt.isPresent();

Optional<String> optOrNull = Optional.ofNullable(null);
System.out.println(opt.isPresent());
        System.out.println(optOrNull.isEmpty());
    }
}
